package com.clz.festec;


import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.ActionBar;

import com.blankj.utilcode.util.ToastUtils;
import com.clz.latte.activities.ProxyActivity;
import com.clz.latte.delegate.LatteDaleGate;
import com.clz.latte.ec.launcher.LauncherDelegate;
import com.clz.latte.ec.main.EcBottomDelegate;
import com.clz.latte.ec.sign.ISignListener;
import com.clz.latte.ec.sign.SignInDelegate;
import com.clz.latte.ui.launcher.ILauncherFinishListener;
import com.clz.latte.ui.launcher.LauncherFinishTag;

import qiu.niorgai.StatusBarCompat;

public class ExampleActivity extends ProxyActivity implements ISignListener, ILauncherFinishListener {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        final ActionBar supportActionBar = getSupportActionBar();
        if (supportActionBar != null) {
            supportActionBar.hide();
        }
        StatusBarCompat.translucentStatusBar(this,true);
    }

    @Override
    public LatteDaleGate setRootDeleGate() {
        return new LauncherDelegate();
    }

    @Override
    public void onSignInSuccess() {
        ToastUtils.showShort("登录成功");
        startWithPop(new EcBottomDelegate());

    }

    @Override
    public void onSignUpSuccess() {
        ToastUtils.showShort("注册并登录成功");
        startWithPop(new EcBottomDelegate());
    }

    @Override
    public void onLauncherFinish(LauncherFinishTag tag) {
        switch (tag) {
            case SIGN_IN:
                startWithPop(new EcBottomDelegate());
                break;
            case NOT_SIGN_IN:
                ToastUtils.showShort("启动结束未登录");
                startWithPop(new SignInDelegate());
                break;
            default:
                break;
        }
    }
}
